﻿<UserControl x:Class="MSDNWebcast.Views.Downloads"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:MSDNWebcast.Controls">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </UserControl.Resources>
    <Grid Margin="0,20,0,0">
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,80,0,0" HorizontalAlignment="Center" Visibility="{Binding Path=ShowInfomation, Converter={StaticResource BooleanToVisibilityConverter}}">
            <TextBlock VerticalAlignment="Center"  Margin="10,0" FontSize="14" Foreground="White">没有网络广播正在下载 !</TextBlock>
        </StackPanel>
        <ScrollViewer Visibility="{Binding Path=ShowDownloadList, Converter={StaticResource BooleanToVisibilityConverter}}">
            <ItemsControl ItemsSource="{Binding Path=DownloadList}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel  Margin="0,10,10,0"></StackPanel>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="10,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>

                            <TextBlock Width="100" Margin="0,5,0,0" DockPanel.Dock="Left" FontSize="13" Text="{Binding Path = Downloader.StartedTime}"
                                VerticalAlignment="Top" Foreground="#8a959e" FontFamily="微软雅黑" LineHeight="22" />

                            <StackPanel Grid.Column="1"  Margin="5,0" HorizontalAlignment="Stretch">
                                <TextBlock Margin="8,0,0,2" Text="{Binding Path = CourseFile.Course.Headline}" FontSize="18" FontStretch="UltraExpanded"
                                    VerticalAlignment="Bottom" Foreground="White" FontFamily="微软雅黑" TextWrapping="Wrap" LineHeight="28" >
                                    <TextBlock Margin="10,0" LineHeight="22" Foreground="#8a959e" FontSize="13" Text="{Binding Path=Downloader.FileSizeInfo}"/>
                                    <TextBlock LineHeight="22" Foreground="#8a959e" FontSize="13" Text="{Binding Path=Downloader.DownloadedSizeInfo}"/>
                                </TextBlock>
                                <TextBlock Margin="8,0,0,12" FontSize="13" FontStretch="UltraExpanded"
                                                     VerticalAlignment="Bottom" Foreground="#8a959e" FontFamily="微软雅黑" TextWrapping="Wrap" LineHeight="22" Text="{Binding Path = CourseFile.Course.Series}">
                                </TextBlock>
                            </StackPanel>
                            <Rectangle Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,10" Height="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" SnapsToDevicePixels="True">
                            </Rectangle>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>
    </Grid>

</UserControl>
